class Solution(object):
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        ans=[[1],[1,1]]
        if numRows==1:
            return [[1]]
        if numRows==2:
            return[[1],[1,1]]
        for i in range(3,numRows+1):
            i-=2
            arr=[]
            last=ans[len(ans)-1]
            for j in range(i):
                arr.append(last[j]+last[j+1])
            arr=[1]+arr+[1]
            ans.append(arr)
        return ans